import aurelienribon.tweenengine.TweenAccessor;

import javax.swing.*;
import java.awt.*;

public class JComponentAccessor implements TweenAccessor<JButton> {
   public  static  final  int  ALPHA=20;
   public  static  final  int SCALE=21;
    @Override
    public int getValues(JButton target, int tweenType, float[] returnValues) {
       switch (tweenType) {
           case ALPHA:
               returnValues[0] = target.getBackground().getRed();
               return ALPHA;
           case SCALE:
               returnValues[0]=0;
               return SCALE;
       }
       return -1;
    }

    @Override
    public void setValues(JButton target, int tweenType, float[] newValues) {
        switch (tweenType) {
            case ALPHA:
                int r = (int) newValues[0];
                System.out.println(newValues[0]);
                //Color c = target.getBackground();
                Color c = new Color(r, 255, 0);
                target.setBackground(c);
                target.validate();
                break;
            case SCALE:

                break;
            default:
                break;

        }
    }
}
